package com.example.admin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.admin.entity.Article;
import com.example.admin.service.ArticleService;
import com.example.admin.service.HomeService;
import com.example.common.utils.RestResponse;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * @author: mtl
 * @Date: 2022/1/24 15:33
 * @Description:
 */
@Service
public class HomeServiceImpl implements HomeService {

    @Resource
    ArticleService articleService;


    @Override
    public RestResponse index() {
        List<Article> index = articleService.home();
        List<String> bane = new ArrayList(3);
        index.forEach(ar->{bane.add(ar.getPatternImg());});
        return RestResponse.succeed().put("batch",bane).put("index",index);
    }
}
